/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_CARACTERIZACAO_VHM")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CaracterizacaoVhm.findAll", query = "SELECT c FROM CaracterizacaoVhm c"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhId", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhId = :cvhId"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhTxObservacao", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhTxObservacao = :cvhTxObservacao"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhCdIgpontopoligono", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhCdIgpontopoligono = :cvhCdIgpontopoligono"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhCdIgpontolinha", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhCdIgpontolinha = :cvhCdIgpontolinha"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhCdIggeometria", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhCdIggeometria = :cvhCdIggeometria"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhCodigoAnaHidro1", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhCodigoAnaHidro1 = :cvhCodigoAnaHidro1"),
    @NamedQuery(name = "CaracterizacaoVhm.findByCvhCodigoAdicionalHidro1", query = "SELECT c FROM CaracterizacaoVhm c WHERE c.cvhCodigoAdicionalHidro1 = :cvhCodigoAdicionalHidro1")})
public class CaracterizacaoVhm implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CVH_ID")
    private BigDecimal cvhId;
    @Size(max = 4000)
    @Column(name = "CVH_TX_OBSERVACAO")
    private String cvhTxObservacao;
    @Column(name = "CVH_CD_IGPONTOPOLIGONO")
    private BigInteger cvhCdIgpontopoligono;
    @Column(name = "CVH_CD_IGPONTOLINHA")
    private BigInteger cvhCdIgpontolinha;
    @Column(name = "CVH_CD_IGGEOMETRIA")
    private BigInteger cvhCdIggeometria;
    @Size(max = 259)
    @Column(name = "CVH_CODIGO_ANA_HIDRO1")
    private String cvhCodigoAnaHidro1;
    @Size(max = 259)
    @Column(name = "CVH_CODIGO_ADICIONAL_HIDRO1")
    private String cvhCodigoAdicionalHidro1;
    @JoinColumn(name = "CVH_VAR_ID", referencedColumnName = "VAR_ID")
    @ManyToOne(optional = false)
    private Variavel cvhVarId;
    @JoinColumn(name = "CVH_UNM_ID", referencedColumnName = "UNM_ID")
    @ManyToOne(optional = false)
    private UnidadeMedida cvhUnmId;
    @JoinColumn(name = "CVH_STO_ID", referencedColumnName = "STO_ID")
    @ManyToOne(optional = false)
    private StatusOperacional cvhStoId;
    @JoinColumn(name = "CVH_PRD_ID", referencedColumnName = "PRD_ID")
    @ManyToOne(optional = false)
    private Periodicidade cvhPrdId;
    @JoinColumn(name = "CVH_PCD_ID", referencedColumnName = "PCD_ID")
    @ManyToOne
    private Pcd cvhPcdId;
    @JoinColumn(name = "CVH_OGU_OPERADOR", referencedColumnName = "OGU_ID")
    @ManyToOne(optional = false)
    private OrgaoUnidade cvhOguOperador;
    @JoinColumn(name = "CVH_OGU_RESPONSAVEL", referencedColumnName = "OGU_ID")
    @ManyToOne(optional = false)
    private OrgaoUnidade cvhOguResponsavel;
    @JoinColumn(name = "CVH_MTO_ID", referencedColumnName = "MTO_ID")
    @ManyToOne(optional = false)
    private MetodoObtencao cvhMtoId;
    @JoinColumn(name = "CVH_MET_ID", referencedColumnName = "MET_ID")
    @ManyToOne(optional = false)
    private MeioTransmissao cvhMetId;
    @JoinColumn(name = "CVH_EST_ID", referencedColumnName = "EST_ID")
    @ManyToOne(optional = false)
    private Estacao cvhEstId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "mdhCvhId")
    private List<MedHidrometeorologica> medHidrometeorologicaList;

    public CaracterizacaoVhm() {
    }

    public CaracterizacaoVhm(BigDecimal cvhId) {
        this.cvhId = cvhId;
    }

    public BigDecimal getCvhId() {
        return cvhId;
    }

    public void setCvhId(BigDecimal cvhId) {
        this.cvhId = cvhId;
    }

    public String getCvhTxObservacao() {
        return cvhTxObservacao;
    }

    public void setCvhTxObservacao(String cvhTxObservacao) {
        this.cvhTxObservacao = cvhTxObservacao;
    }

    public BigInteger getCvhCdIgpontopoligono() {
        return cvhCdIgpontopoligono;
    }

    public void setCvhCdIgpontopoligono(BigInteger cvhCdIgpontopoligono) {
        this.cvhCdIgpontopoligono = cvhCdIgpontopoligono;
    }

    public BigInteger getCvhCdIgpontolinha() {
        return cvhCdIgpontolinha;
    }

    public void setCvhCdIgpontolinha(BigInteger cvhCdIgpontolinha) {
        this.cvhCdIgpontolinha = cvhCdIgpontolinha;
    }

    public BigInteger getCvhCdIggeometria() {
        return cvhCdIggeometria;
    }

    public void setCvhCdIggeometria(BigInteger cvhCdIggeometria) {
        this.cvhCdIggeometria = cvhCdIggeometria;
    }

    public String getCvhCodigoAnaHidro1() {
        return cvhCodigoAnaHidro1;
    }

    public void setCvhCodigoAnaHidro1(String cvhCodigoAnaHidro1) {
        this.cvhCodigoAnaHidro1 = cvhCodigoAnaHidro1;
    }

    public String getCvhCodigoAdicionalHidro1() {
        return cvhCodigoAdicionalHidro1;
    }

    public void setCvhCodigoAdicionalHidro1(String cvhCodigoAdicionalHidro1) {
        this.cvhCodigoAdicionalHidro1 = cvhCodigoAdicionalHidro1;
    }

    public Variavel getCvhVarId() {
        return cvhVarId;
    }

    public void setCvhVarId(Variavel cvhVarId) {
        this.cvhVarId = cvhVarId;
    }

    public UnidadeMedida getCvhUnmId() {
        return cvhUnmId;
    }

    public void setCvhUnmId(UnidadeMedida cvhUnmId) {
        this.cvhUnmId = cvhUnmId;
    }

    public StatusOperacional getCvhStoId() {
        return cvhStoId;
    }

    public void setCvhStoId(StatusOperacional cvhStoId) {
        this.cvhStoId = cvhStoId;
    }

    public Periodicidade getCvhPrdId() {
        return cvhPrdId;
    }

    public void setCvhPrdId(Periodicidade cvhPrdId) {
        this.cvhPrdId = cvhPrdId;
    }

    public Pcd getCvhPcdId() {
        return cvhPcdId;
    }

    public void setCvhPcdId(Pcd cvhPcdId) {
        this.cvhPcdId = cvhPcdId;
    }

    public OrgaoUnidade getCvhOguOperador() {
        return cvhOguOperador;
    }

    public void setCvhOguOperador(OrgaoUnidade cvhOguOperador) {
        this.cvhOguOperador = cvhOguOperador;
    }

    public OrgaoUnidade getCvhOguResponsavel() {
        return cvhOguResponsavel;
    }

    public void setCvhOguResponsavel(OrgaoUnidade cvhOguResponsavel) {
        this.cvhOguResponsavel = cvhOguResponsavel;
    }

    public MetodoObtencao getCvhMtoId() {
        return cvhMtoId;
    }

    public void setCvhMtoId(MetodoObtencao cvhMtoId) {
        this.cvhMtoId = cvhMtoId;
    }

    public MeioTransmissao getCvhMetId() {
        return cvhMetId;
    }

    public void setCvhMetId(MeioTransmissao cvhMetId) {
        this.cvhMetId = cvhMetId;
    }

    public Estacao getCvhEstId() {
        return cvhEstId;
    }

    public void setCvhEstId(Estacao cvhEstId) {
        this.cvhEstId = cvhEstId;
    }

    @XmlTransient
    public List<MedHidrometeorologica> getMedHidrometeorologicaList() {
        return medHidrometeorologicaList;
    }

    public void setMedHidrometeorologicaList(List<MedHidrometeorologica> medHidrometeorologicaList) {
        this.medHidrometeorologicaList = medHidrometeorologicaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cvhId != null ? cvhId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CaracterizacaoVhm)) {
            return false;
        }
        CaracterizacaoVhm other = (CaracterizacaoVhm) object;
        if ((this.cvhId == null && other.cvhId != null) || (this.cvhId != null && !this.cvhId.equals(other.cvhId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.CaracterizacaoVhm[ cvhId=" + cvhId + " ]";
    }
    
}
